/*------------------------------------------------------------------------------
*** PURPOSE: 	The following do-file generates Figure 3 in the paper "Respondent 
				biases in household surveys" by Andrew Dillon and Edouard Romeo 
				Mensah. 

*** NOTE:		Relevant globals are defined in the do-file titles "master.do"
				contained in the folder "02_do" in the replication package.
------------------------------------------------------------------------------*/	
	
	
	* Figure 3. Time (minutes) for completing the agriculture module.

	
	tabstat time_ag_ms, by(treatarm)
	reg time_ag_ms i.treatarm
	
/*
    treatarm |      mean
-------------+----------
     Control |  15.31988
     HH head |  6.046377
Random proxy |  10.61905
-------------+----------
       Total |  10.67121
------------------------
-------------------------------------------------------------------------------
   time_ag_ms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
     treatarm |
     HH head  |  -9.273508   1.530319    -6.06   0.000    -12.27642   -6.270591
Random proxy  |  -4.700837   1.540562    -3.05   0.002    -7.723854    -1.67782
              |
        _cons |   15.31988   1.080534    14.18   0.000     13.19957     17.4402
-------------------------------------------------------------------------------
*/

	cibar time_ag_ms, over1(treatarm) ///
	graphopts( legend( order(1 "Self-report" 2 "Household head" 3 "Random proxy")) ///
	xtitle("Survey design group") ytitle("Mean time (minutes)") ///
	title("") name(timeag, replace))
	
	tabstat time_ag_ms if treatarm==2, by(resp_female)
	reg time_ag_ms i.resp_female if treatarm==2
	
/*
resp_female |      mean
------------+----------
          0 |  10.37736
          1 |  11.49533
------------+----------
      Total |  10.75235
-----------------------
-------------------------------------------------------------------------------
   time_ag_ms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
1.resp_female |   1.117969   1.737896     0.64   0.521      -2.3013    4.537237
        _cons |   10.37736   1.006515    10.31   0.000     8.397064    12.35765
-------------------------------------------------------------------------------
*/	
	
	cibar time_ag_ms if treatarm==2, over1(resp_female) ///
	graphopts( legend( order(1 "Male" 2 "Female")) ///
	xtitle("Gender of the random proxy respondent") ytitle("Mean time (minutes)") ///
	title("") name(timeagrp, replace))
	
	graph combine timeag timeagrp, ycommon /// 
	title("Time for administering the agriculture questionnaire module") ///
	subtitle("Mean and 95% confidence interval")
	graph save "04_output\Figure 3. Time of completion of the agriculture questionnaire module.gph", replace
	
	